fix(python): de-flake test_invoke_script_with_line_flush - #2
Closed
omarqureshi wants to merge 4 commits into
Closed
Conversation
The test asserted exact rounded inter-line delays (== 0 / == 1), which is brittle on loaded machines where startup jitter or a slow 1s sleep rounds the measured delay to an unexpected value. Split the assertion into the two properties that matter: - the output lines match exactly - each line printed after a sleep arrived >= 1s after the previous one (all delays would be ~0 if output were buffered to process exit) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds support for jsii-rosetta 6.0 following the process in CONTRIBUTING.md. This upgrades jsii and jsii-rosetta to 6.0 across all packages and updates TypeScript to 6.x. The jsii-pacmak peer dependency now supports `>=5.9.0` to cover both 5.9 and 6.0. The TypeScript 6.0 upgrade required fixing deprecated compiler options in `tsconfig-base.json`: `esModuleInterop` is now `true` and `moduleResolution` is `Node16`. These changes cascaded into import fixes across the codebase — `import * as X` for default-exported modules needed to become `import X`. The `jsii-config` package was converted to ESM (`"type": "module"`) because `@inquirer/prompts` v8 is ESM-only, using `rewriteRelativeImportExtensions` to keep `.ts` extensions in source. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
Ran npm-check-updates and yarn up to keep the `yarn.lock` file up-to-date.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Managed to get this test to fail whilst working on ruby language bindings.
test_invoke_script_with_line_flushasserted exact rounded inter-line delays (== 0/== 1), which is brittle on loaded machines: startup jitter or a slow 1s sleep can round a measured delay to an unexpected value and fail the test spuriously.This splits the assertion into the two properties the test actually exists to verify:
delay(1000)arrived >= 1s after the previous lineThe streaming/no-buffering guarantee is preserved: if stdout were block-buffered, all lines would arrive in one burst at process exit and every inter-line delay from index 3 onward would be ~0, failing the new assertion.
The script that this test counts relies on reads as follows:
as such the expected output is:
Hello World!last_dtis initialized on the first linearguments: arg1, delaysleeping 1s 1await delay(1000)sleeping 1s 2sleeping 1s 3..5🤖 Generated with Claude Code
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.